home *** CD-ROM | disk | FTP | other *** search
- <?xml version='1.0' ?>
- <!-- /*//////////////////////////////////////////////////////////////////////
- //filename: log.xsl
- //copyright(c): Tiny Software corp 2002, 2003 (http://www.tinysoftware.com)
- //author: Jozef Palocko (jpalocko@tinysoftware.com)
- //product: Tiny Personal Firewall 5.x
- //description: Log analyzer stylesheet
- //changelog:
- // 18.8.2003 - added displaying date in local time zone
- ///////////////////////////////////////////////////////////////////////*/ -->
- <xsl:stylesheet version="1.0"
- xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
- xmlns:msxsl="urn:schemas-microsoft-com:xslt"
- xmlns:time="http://mycompany.com/mynamespace">
-
-
- <xsl:output method="html" indent="yes" />
- <msxsl:script language="JScript" implements-prefix="time">
- <![CDATA[
- function LocalTime(node)
- {
- nd = node.nextNode();
- t = new Date(Date.parse(nd.getAttribute("dateTimeLast")));
- return t.toLocaleString( );
- }
- ]]>
- </msxsl:script>
-
- <xsl:variable name="Def" select="document('../FncIds.xml ')"/>
- <xsl:variable name="Filter" select="document('filter.xml')"/>
- <xsl:template match="/">
- <style>
- <xsl:text>
- BODY {
- font-family: "MS Sans serif", "Verdana", "Tahoma" ;
- font-size: 10px;
- background-color: #ffffff;
- color:#000000;
- }
- .clsFirewall{
- background-color: #dbfeda;
- height:10px;
- }
- .clsSandbox{
- height:10px;
- background-color: #ffc9c6;
- }
- .clsIDS{
- height:10px;
- background-color: #ffffd7;
- }
- .clsEvent{
- background-color: #fafafa;
- text-align : left;
- margin-bottom: 10px;
- }
- .clsAllow{
- color =#2e8b57;
- font-weight : bold;
- }
- .clsPrevent{
- color =#ff0000;
- font-weight : bold;
- }
- .clsAskUser{
- color =#00ffff;
- font-weight : bold;
- }
-
-
- </xsl:text>
- </style>
-
- <xsl:call-template name="tplModule">
- <xsl:with-param name="Events" select="/Root/Event"/>
- </xsl:call-template>
- </xsl:template>
-
- <!--
- //////////////////////////////////////
- ///////// Named filter templates
- -->
-
- <!-- ///////// tplModule //////////// -->
-
- <xsl:template name="tplModule" >
- <xsl:param name="Events"/>
- <xsl:choose>
- <xsl:when test="$Filter//module=1">
- <xsl:call-template name="tplObject">
- <xsl:with-param name="Events" select="$Events[@module = 1 ]"/>
- </xsl:call-template>
- </xsl:when>
- <xsl:when test="$Filter//module=2">
- <xsl:call-template name="tplDirection">
- <xsl:with-param name="Events" select="$Events[@module = 2 ]"/>
- </xsl:call-template>
- </xsl:when>
- <xsl:when test="$Filter//module=16">
- <xsl:call-template name="tplMessage">
- <xsl:with-param name="Events" select="$Events[@module = 16 ]"/>
- </xsl:call-template>
- </xsl:when>
- <xsl:otherwise>
- <xsl:call-template name="tplAr">
- <xsl:with-param name="Events" select="$Events"/>
- </xsl:call-template>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
- <!-- ///////// tplObject //////////// -->
-
- <xsl:template name="tplObject" >
- <xsl:param name="Events"/>
- <xsl:choose>
- <xsl:when test="$Filter//string=''">
- <xsl:call-template name="tplAr">
- <xsl:with-param name="Events" select="$Events"/>
- </xsl:call-template>
- </xsl:when>
- <xsl:otherwise>
- <xsl:call-template name="tplAr">
- <xsl:with-param name="Events" select="$Events[contains(
- translate( Object, '_-\/.:;,ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789' , '_-\/.:;,abcdefghijklmnopqrstuvwxyz0123456789'),
- translate($Filter//string,'_-\/.:;,ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789','_-\/.:;,abcdefghijklmnopqrstuvwxyz0123456789'))]"/>
-
- </xsl:call-template>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
- <!-- ///////// tplMessage //////////// -->
-
- <xsl:template name="tplMessage" >
- <xsl:param name="Events"/>
- <xsl:choose>
- <xsl:when test="$Filter//string=''">
- <xsl:call-template name="tplAr">
- <xsl:with-param name="Events" select="$Events"/>
- </xsl:call-template>
- </xsl:when>
- <xsl:otherwise>
- <xsl:call-template name="tplAr">
- <xsl:with-param name="Events" select="$Events[contains(
- translate( Msg, '_-\/.:;,ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789' , '_-\/.:;,abcdefghijklmnopqrstuvwxyz0123456789'),
- translate($Filter//string,'_-\/.:;,ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789','_-\/.:;,abcdefghijklmnopqrstuvwxyz0123456789'))]"/>
-
- </xsl:call-template>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
-
-
- <!-- ///////// tplDirection //////////// -->
- <xsl:template name="tplDirection" >
- <xsl:param name="Events"/>
- <xsl:choose>
- <xsl:when test="$Filter//direction=''">
- <xsl:call-template name="tplProtocol">
- <xsl:with-param name="Events" select="$Events"/>
- </xsl:call-template>
- </xsl:when>
- <xsl:otherwise>
- <xsl:call-template name="tplProtocol">
- <xsl:with-param name="Events" select="$Events[InetDef/@dir = $Filter//direction]"/>
- </xsl:call-template>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
-
- <!-- ///////// tplProtocol //////////// -->
- <xsl:template name="tplProtocol" >
- <xsl:param name="Events"/>
- <xsl:choose>
- <xsl:when test="$Filter//protocol=''">
- <xsl:call-template name="tplIPAddress">
- <xsl:with-param name="Events" select="$Events"/>
- </xsl:call-template>
- </xsl:when>
- <xsl:otherwise>
- <xsl:call-template name="tplIPAddress">
- <xsl:with-param name="Events" select="$Events[contains(InetDef/@prot , $Filter//protocol)]"/>
- </xsl:call-template>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
-
- <!-- ///////// tplIPAddress //////////// -->
- <xsl:template name="tplIPAddress" >
- <xsl:param name="Events"/>
- <xsl:choose>
- <xsl:when test="$Filter//ip=''">
- <xsl:call-template name="tplRemPort">
- <xsl:with-param name="Events" select="$Events"/>
- </xsl:call-template>
- </xsl:when>
- <xsl:otherwise>
- <xsl:call-template name="tplRemPort">
- <xsl:with-param name="Events" select="$Events[contains(
- translate( InetDef/@remIp, '_-\/.:;,ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789' , '_-\/.:;,abcdefghijklmnopqrstuvwxyz0123456789'),
- translate($Filter//ip,'_-\/.:;,ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789','_-\/.:;,abcdefghijklmnopqrstuvwxyz0123456789'))]"/>
- </xsl:call-template>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
-
- <!-- ///////// tplRemPort //////////// -->
-
- <xsl:template name="tplRemPort" >
- <xsl:param name="Events"/>
- <xsl:choose>
- <xsl:when test="$Filter//remport=''">
- <xsl:call-template name="tplLocPort">
- <xsl:with-param name="Events" select="$Events"/>
- </xsl:call-template>
- </xsl:when>
- <xsl:otherwise>
- <xsl:call-template name="tplLocPort">
- <xsl:with-param name="Events" select="$Events[InetDef/@remPort = $Filter//remport]"/>
- </xsl:call-template>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
- <!-- ///////// tplLocPort //////////// -->
-
- <xsl:template name="tplLocPort" >
- <xsl:param name="Events"/>
- <xsl:choose>
- <xsl:when test="$Filter//locport=''">
- <xsl:call-template name="tplAr">
- <xsl:with-param name="Events" select="$Events"/>
- </xsl:call-template>
- </xsl:when>
- <xsl:otherwise>
- <xsl:call-template name="tplAr">
- <xsl:with-param name="Events" select="$Events[InetDef/@locPort = $Filter//locport]"/>
- </xsl:call-template>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
- <!-- ///////// tpl access result //////////// -->
- <xsl:template name="tplAr" >
- <xsl:param name="Events"/>
- <xsl:choose>
- <xsl:when test="$Filter//ar=''">
- <xsl:call-template name="tplApplication">
- <xsl:with-param name="Events" select="$Events"/>
- </xsl:call-template>
- </xsl:when>
- <xsl:otherwise>
- <xsl:call-template name="tplApplication">
- <xsl:with-param name="Events" select="$Events[Action/@ar = $Filter//ar]"/>
- </xsl:call-template>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
- <!-- ///////// tplApplication result //////////// -->
-
- <xsl:template name="tplApplication" >
- <xsl:param name="Events"/>
- <xsl:choose>
- <xsl:when test="$Filter//app=''">
- <xsl:apply-templates select="$Events"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:apply-templates select="$Events[contains(
- translate( App, '_-\/.:;,ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789' , '_-\/.:;,abcdefghijklmnopqrstuvwxyz0123456789'),
- translate($Filter//app,'_-\/.:;,ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789','_-\/.:;,abcdefghijklmnopqrstuvwxyz0123456789'))]"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
- <!--
- //////////////////////////////////////
- ///////// Element templates
- -->
-
- <!-- ///////// Event //////////// -->
- <xsl:template match="Event">
- <div class="clsEvent" >
- <div >
- <xsl:attribute name="class">
- <xsl:choose>
- <xsl:when test="@module=1">clsSandbox</xsl:when>
- <xsl:when test="@module=2">clsFirewall</xsl:when>
- <xsl:when test="@module=16">clsIDS</xsl:when>
- </xsl:choose>
- </xsl:attribute>
-
- <xsl:text>Module: </xsl:text>
- <xsl:choose>
- <xsl:when test="@module=1"> <b>Windows security</b> </xsl:when>
- <xsl:when test="@module=2"> <b>Firewall</b> </xsl:when>
- <xsl:when test="@module=16"> <b>IDS</b> </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="@module"/>
- </xsl:otherwise>
- </xsl:choose>
-
- <xsl:text> Date: </xsl:text>
- <xsl:value-of select="time:LocalTime(.)"/>
- <!-- <xsl:value-of select="@dateTimeLast" />-->
- <xsl:if test="@user">
- <xsl:text> User: </xsl:text>
- <B>[<xsl:value-of select="@user" />] </B>
- </xsl:if>
- <xsl:if test="@domain">
- <xsl:text> Domain: </xsl:text>
- <B>[<xsl:value-of select="@domain" />] </B>
- </xsl:if>
-
- </div>
- <xsl:if test="@count">
- <B> Count: </B>
- <xsl:value-of select="@count" />
- </xsl:if>
- <!-- <xsl:if test="@ruleID">
- <B> RULEID: </B>
- <xsl:value-of select="@ruleID" />
- </xsl:if>
- -->
- <xsl:apply-templates />
- </div>
- </xsl:template>
-
- <!-- ///////// Object //////////// -->
- <xsl:template match="Object">
- <B> Ot: </B>
- <xsl:choose>
- <xsl:when test="@ot='0x00000001'">file</xsl:when>
- <xsl:when test="@ot='0x00000002'">service</xsl:when>
- <xsl:when test="@ot='0x00000004'">registry key</xsl:when>
- <xsl:when test="@ot='0x00000008'">Spawning object</xsl:when>
- <xsl:when test="@ot='0x00000010'">Device</xsl:when>
- <xsl:when test="@ot='0x00000020'">VBA Macro</xsl:when>
- <xsl:when test="@ot='0x00000040'">COM object</xsl:when>
- <xsl:when test="@ot='0x00000080'">System privileges</xsl:when>
- <xsl:when test="@ot='0x00000400'">Transport object</xsl:when>
- <xsl:when test="@ot='0x10000000'">Action</xsl:when>
- <xsl:when test="@ot='0x20000000'">Message</xsl:when>
- </xsl:choose>
- <B> Object: </B>
- <xsl:value-of select="." />
- <BR />
- </xsl:template>
-
- <!-- ///////// App //////////// -->
- <xsl:template match="App">
- <B>App: </B>
- <xsl:value-of select="." />
- <BR />
- <xsl:if test="@chksm">
- <B> Chksm: </B>
- <xsl:value-of select="@chksm" />
- </xsl:if>
- </xsl:template>
-
- <!-- ///////// Action //////////// -->
- <xsl:template match="Action">
- <B>Action:</B>
- <xsl:choose>
- <xsl:when test="@ar=1">
- <span class="clsAllow"> Allow </span>
- </xsl:when>
- <xsl:when test="@ar=0">
- <span class="clsPrevent"> Prevent</span>
- </xsl:when>
- <xsl:when test="@ar=2">
- <span class="clsAskUser"> Ask User</span>
- </xsl:when>
- </xsl:choose>
-
- <xsl:if test="@fnc">
- <B> Fnc: </B>
- <xsl:variable name="ID" select="@fnc" /> <xsl:value-of select="$Def//Fnc[@id_dec=$ID]" /> (<xsl:value-of select="$ID" />)
- <BR />
- </xsl:if>
- </xsl:template>
-
- <!-- ///////// Msg //////////// -->
- <xsl:template match="Msg">
- <B>Msg: </B>
- <xsl:value-of select="." />
- <br />
- </xsl:template>
-
- <!-- ///////// InetDef //////////// -->
- <xsl:template match="InetDef">
- <B>Prot: </B>
- <xsl:value-of select="@prot" />
- <B> Dir: </B>
- <xsl:value-of select="@dir" />
- <B> RemIp: </B>
- <xsl:value-of select="@remIp" />
- <xsl:if test="@locPort">
- <B> LocPort: </B>
- <xsl:value-of select="@locPort" />
- </xsl:if>
- <xsl:if test="@locPort">
- <B> RemPort: </B>
- <xsl:value-of select="@remPort" />
- <BR />
- </xsl:if>
- <xsl:if test="@icmpFn">
- <B> IcmpFn: </B>
- <xsl:value-of select="@icmpFn" />
- <BR />
- </xsl:if>
- <xsl:if test="@locIp">
- <B> LocIp: </B>
- <xsl:value-of select="@locIp" />
- <BR />
- </xsl:if>
- </xsl:template>
- </xsl:stylesheet>
-